new Vue({
  el: '#app',
  data() {
    return {
      form: {
        Data: "user_agreement",//type 默认空是全部
        Enterprise_Info_SerialNumber: $.cookie("enterprise"),//状态
        page: 1,			//页数
        limit: 10,	//每页数据条数
      },
      formData: {},
      tableData: [],		//表格数据
      total: 0,
      dialogForm: false,
      title: '',
      NewsInfo: '',
      multipleSelection: []
    }
  },
  mounted() {
    this.getList(this.form)
  },
  methods: {
    // onSerach(data) {//查询方法

    // },
    addContract() {
      console.log("跳转")
    },
    handleSizeChange(val) {
      this.form.page = 1;
      this.form.limit = val;
      this.getList(this.form)
    },
    handleCurrentChange(val) {
      this.form.page = val;
      this.getList(this.form)
    },
    getList(data) {     //换页方法
      let _this = this
      $.ajax({
        type: 'POST',
        url: DomainName + '/getTableInquiryAction?token=' + $.cookie("token"),
        data,
        complete: function (XMLHttpRequest) {
          _this.loading = false
          if (XMLHttpRequest.getResponseHeader("REDIRECT") == "REDIRECT") {
            window.parent.document.location.href = "../../../" + XMLHttpRequest.getResponseHeader("CONTENTPATH");
          }
        },
        success: function (Result) {
          console.log(Result);
          _this.tableData = Result.tableData      //将获取的数据存到表格数据中
          _this.total = Number(Result.limit)
        },
        dataType: "json"
      });
    },
    addEnterprise() {
      window.location.href = './Add.html'
    },
    // editMember(Item_SerialNumber) {
    //   sessionStorage.setItem("Item_SerialNumber", Item_SerialNumber)
    //   window.location.href = './Edit.html?Item_SerialNumber=' + Item_SerialNumber
    // },
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },
    SeeDetail(row) {
      console.log(row.User_Agreement_SerialNumber);
      window.sessionStorage.setItem('User_Agreement_SerialNumber', row.User_Agreement_SerialNumber)
      window.location.href = './Edit.html'
    },
    view(row) {
      window.sessionStorage.setItem('User_Agreement_SerialNumber', row.User_Agreement_SerialNumber)
      window.location.href = './View.html'
    },
    deletMember(row) {
      this.$confirm('此操作将删除该新闻, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning',
        center: true
      }).then(() => {
        this.Delete(row);
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        });
      });
    },
    Delete(row) {
      const _this = this
      row.Row_Status = 1;
      $.ajax({
        url: DomainName + '/getEditAction?token=' + $.cookie("token"),
        type: 'POST',
        data: {
          Data: JSON.stringify(
            {
              Modify: { 'user_agreement': [row] },
            }
          )
        },
        success: function (res) {
          console.log(res);
          if (res.Status == 'success') {
            _this.$message({
              type: 'success',
              message: '已删除!'
            });
            _this.getList(_this.form)
          }
        },
        complete: function (XMLHttpRequest) {
          _this.loading = false
          if (XMLHttpRequest.getResponseHeader("REDIRECT") == "REDIRECT") {
            window.parent.document.location.href = "../../../" + XMLHttpRequest.getResponseHeader("CONTENTPATH");
          }
        }
      })
    }
  },
})